﻿using System;
using System.Data;
using System.Web;
using System.Web.UI.WebControls;
using Texfina.Core.Common;
using Texfina.Core.Web;
using Texfina.Core.Data;
using Texfina.Entity.Mg;
using MGBOQry = Texfina.BOQry.Mg;

namespace MG
{
   public partial class wfOcupacionBnd : SearchPage
   {
      protected void Page_Load(object sender, EventArgs e)
      {
         this.LoadInitialSettings();
         if (this.IsPostBack)
         {
            this.LoadInPostBack();
            return;
         }

         this.LoadData();
         SearchData();

      }

      public override void LoadInitialSettings()
      {
         Label lbl = (Label)this.Master.FindControl("lblTitle");
         lbl.Text = "Ocupacion";
         this.Page.Form.DefaultButton = bttSearch.UniqueID;
      }

      public override void SearchData()
      {

         EOcupacion objE = new EOcupacion();

         objE.DsOcupa = this.txtdsDescripcion.Text;
         objE.StEjecutivo = Request.QueryString["StEjecutivo"];
         objE.StEmpleado = Request.QueryString["StEmpleado"];
         objE.StObrero = Request.QueryString["StObrero"];

         IBOQuery objBO = (IBOQuery)WCFHelper.GetObject<IBOQuery>(typeof(MGBOQry.Ocupacion));
         DataTable dt = objBO.GetByCriteria(objE);

         this.GridSetDataBinding(grdList, dt);

      }

      protected void bttOk_Click(object sender, EventArgs e)
      {
         this.SearchData(); 
      }

       protected void grdList_RowCreated(object sender,GridViewRowEventArgs e)
       {
          if (e.Row.RowType == DataControlRowType.DataRow)
          {
             e.Row.Attributes.Add("ondblclick", "rowDblClick(" + e.Row.RowIndex.ToString() + ")");
          }
       }
   }
}